module controller.index_ctrl;

import vibe.http.server : HTTPServerRequest, HTTPServerResponse;

import model.article;
import model.category;
import service.article_service;
import service.cate_service;
import service.focus_service;

import darktemple.render;

/** 
 * 首页
 */
void getIndexPage (scope HTTPServerRequest req, scope HTTPServerResponse res)
{
    Article[] articleList = getArticleList();
    Category[] categoryList = getCategoryList();
    Article[] focusList = getFocusList();

    string html = renderFile!("index.tmpl", articleList, categoryList, focusList);
    res.writeBody(html, "text/html; charset=utf-8");
}
